#!/bin/bash
#chkconfig: 2345 70 30  #234

VIP={{lvs_vip}}
source /etc/rc.d/init.d/functions
case "$1" in
start)
        ifconfig lo:0 $VIP netmask 255.255.255.255 broadcast $VIP
        #ip add add ${VIP}/32  broadcast ${VIP} label lo:0 dev lo
        /sbin/route add -host $VIP dev lo:0
        echo "1" >/proc/sys/net/ipv4/conf/lo/arp_ignore
        echo "2" >/proc/sys/net/ipv4/conf/lo/arp_announce
        echo "1" >/proc/sys/net/ipv4/conf/all/arp_ignore
        echo "2" >/proc/sys/net/ipv4/conf/all/arp_announce
        echo "RealServer Start OK"
        ;;
stop)
        ifconfig lo:0 down
        #ip add del ${VIP}/32 dev lo label lo:0
        route del $VIP >/dev/null 2>&1
        echo "0" >/proc/sys/net/ipv4/conf/lo/arp_ignore
        echo "0" >/proc/sys/net/ipv4/conf/lo/arp_announce
        echo "0" >/proc/sys/net/ipv4/conf/all/arp_ignore
        echo "0" >/proc/sys/net/ipv4/conf/all/arp_announce
        echo "RealServer Stoped"
        ;;
        *)
        echo "Usage: $0 {start|stop}"
        exit 1
esac
exit 0

